<?php

/**
 * 竞拍详情
 *
 * Created by PhpStorm.
 * User: evan
 * Date: 16/9/1
 * Time: 下午7:31
 */
class Detail extends MY_Api_Controller
{
    /**
     * 详情页面
     */
    public function index()
    {
        $uid = $this->uid;
        $aid = (int)$this->input->get_post('aid');


        $this->load->service('auction/service_auction_detail');
        $data = $this->service_auction_detail->index($aid, $uid);


        $this->json_output($data['data'], $data['status']);
    }


    /**
     * 加载更多留言
     */
    public function load_more_message()
    {
        $aid   = (int)$this->input->get_post('aid');
        $page  = (int)$this->input->get_post('page');
        $limit = (int)$this->input->get_post('limit');


        $this->load->service('auction/service_auction_detail');
        $data = $this->service_auction_detail->load_more_message($aid, $page, $limit);


        foreach ($data['data'] as $k => $v)
        {
            unset($data['data'][$k]['ip']);
            unset($data['data'][$k]['status']);
            unset($data['data'][$k]['reply_uid']);
            unset($data['data'][$k]['reply_uname']);
            unset($data['data'][$k]['reply_content']);
            unset($data['data'][$k]['reply_ip']);
            unset($data['data'][$k]['reply_time']);
            unset($data['data'][$k]['opposition']);
        }


        $this->json_output($data['data'], $data['status']);
    }


    /**
     * 加载更多历史交易记录
     */
    public function load_more_history()
    {
        $aid   = (int)$this->input->get_post('aid');
        $page  = (int)$this->input->get_post('page');
        $limit = (int)$this->input->get_post('limit');


        $this->load->service('auction/service_auction_detail');
        $data = $this->service_auction_detail->load_more_history($aid, $page, $limit);


        $this->json_output($data['data'], $data['status']);
    }


    /**
     * 加载更多最新出价
     */
    public function load_more_price()
    {
        $aid   = (int)$this->input->get_post('aid');
        $page  = (int)$this->input->get_post('page');
        $limit = (int)$this->input->get_post('limit');


        $this->load->service('auction/service_auction_detail');
        $data = $this->service_auction_detail->load_more_price($aid, $page, $limit);


        $this->json_output($data['data'], $data['status']);
    }
}